package Exp_2;

public class Test {
    public static void main(String[] args) {
        String preStr1="ABDF###E##C##";
        String preStr2="AB##CDF##G##E##";
        int k = 5;

        System.out.println("第一棵树:"+preStr1);
        BiTree T= new BiTree(preStr1);
        System.out.println("先根遍历第"+k+"个元素");
        System.out.println(T.searchPre(T.root,k));
        System.out.println("中根遍历第"+k+"个元素");
        System.out.println(T.searchIn(T.root,k));
        System.out.println("后根遍历第"+k+"个元素");
        System.out.println(T.searchPost(T.root,k));
        if (T.isCompleteTree()) {
            System.out.println("完全二叉树");
        } else {
            System.out.println("非完全二叉树");
        }

        T.indexTo0();//将index归0

        System.out.println("第二棵树:"+preStr2);
        BiTree H= new BiTree(preStr2);
        System.out.println("先根遍历第"+k+"个元素");
        System.out.println(H.searchPre(H.root,k));
        System.out.println("中根遍历第"+k+"个元素");
        System.out.println(H.searchIn(H.root,k));
        System.out.println("后根遍历第"+k+"个元素");
        System.out.println(H.searchPost(H.root,k));
        if (H.isCompleteTree()) {
            System.out.println("完全二叉树");
        } else {
            System.out.println("非完全二叉树");
        }
    }
}
